package com.three.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author wzm
 * @create 2023-11-08 16:38
 * project_name:web2310
 * @Description
 */
//手动实现过滤器
//配置过滤器的拦截路径
//@WebFilter("/*")
public class FilterDemo1 implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    //过滤器的核心方法
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.out.println("不好意思，你被拦住了前");
        //做些代码的操作

        //放行
        chain.doFilter(request,response);

        System.out.println("你已经被放行了后");
    }

    @Override
    public void destroy() {

    }
}
